package org.kunteng.yunac.util;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class DBConn {
  static Connection conn = null;

  /**
   * 连接数据库
   * 
   * @return
   */
  public Connection getConn() {
    try {
      String url = "jdbc:mysql://localhost:3306/yunac?useUnicode=true&characterEncoding=utf8";
      String user = "root";
      String pwd = "p@ssw0rd";

//      url = "jdbc:mysql://192.168.20.83:3306/yunac?useUnicode=true&characterEncoding=utf8";
//      user = "root";
//      pwd = "123456";
      
//      url = "jdbc:mysql://192.168.20.86:3306/yunac?useUnicode=true&characterEncoding=utf8";
//      user = "yunac";
//      pwd = "h2in5u5J!";
      
//      url = "jdbc:mysql://192.168.18.36:3306/yunac?useUnicode=true&characterEncoding=utf8";
//      user = "yunac";
//      pwd = "h2in5u5J!";
      
//      url = "jdbc:mysql://localhost:3306/wifimh?useUnicode=true&characterEncoding=utf8";
//      user = "root";
//      pwd = "p@ssw0rd";

      url = "jdbc:mysql://192.168.18.36:3306/yunpos?useUnicode=true&characterEncoding=utf8";
      user = "pos";
      pwd = "YeX4L6@H";

      Class.forName("org.gjt.mm.mysql.Driver").newInstance();
      conn = DriverManager.getConnection(url, user, pwd);
    } catch (SQLException ex) {
      ex.printStackTrace();
    } catch (Exception ex) {
      ex.printStackTrace();
    }
    return conn;
  }

}